home *** CD-ROM | disk | FTP | other *** search
/ Practical Internet 2002 May / Practical Internet May 2002.iso / pc / Software / SiteBuilding / Cpg27.exe / #setuppath# / Objects / Flash / Flare / Slide In Text.cpao < prev    next >
Encoding:
Text File  |  2002-01-28  |  16.5 KB  |  443 lines

  1. <HTML>
  2. <HEAD>
  3. <SCRIPT LANGUAGE="JavaScript">
  4. <!-- Begin
  5. // Put all strings here for easier translation to other languages
  6. var title = "Flare SWFlet : Slide In Text";
  7. var swf_file = "Slide In Text1.swf";
  8. var swf_file1 = "Slide In Text1.swf";
  9. var swf_file2 = "Slide In Text2.swf";
  10. var swf_file3 = "Slide In Text3.swf";
  11. var logo_file = "Flare SWFlet Logo.gif"
  12. var requires_cp = "The file requires Cool Page to be viewed";
  13. var requires_cp_update = "To edit this object, please upgrade your copy of Cool Page to the latest version";
  14. var unexpected_error = "An unexpected error occurred. Please notify http://www.imediabuilders.com";
  15. var swfwidth=468;
  16. var swfheight=60;
  17. var swfcolor="1";
  18. var editor=window.external.GetObjectEditor("-1");
  19. var objects_folder=editor.substring(0,editor.lastIndexOf("\\Flash")+1);
  20.  
  21. document.write( "<TITLE>" + title + "</TITLE>" );
  22.  
  23. // Not running inside Cool Page?
  24. if( !window.external || !window.external.Undefined || !window.external.Defined || 
  25.     (undefined = window.external.Undefined()) == (defined = window.external.Defined() ))
  26. {
  27.     AlertClose( requires_cp );
  28. }
  29.  
  30. // Initialize HTML for the first time
  31. if(window.external.GetObjectHTML("-1") == defined)
  32.     window.external.SetObjectSize("-1","1","1");
  33.  
  34. // Not running a version of Cool Page which supports all the APIs we use?
  35. // (note: add to this test any Cool Page APIs you call in this file)
  36. var w, h;
  37. if( defined == undefined
  38.     || !window.external.GetSelectedObject || window.external.GetSelectedObject( "-1" ) == undefined
  39.     || !window.external.GetObjectClass || window.external.GetObjectClass( "-1" ) != "PageHTML"
  40.     || !window.external.SetObjectEditorName || window.external.SetObjectEditorName( "-1", title ) == undefined
  41.     || !window.external.GetObjectWidth || (w = window.external.GetObjectWidth( "-1" )) == undefined
  42.     || !window.external.GetObjectHeight || (h = window.external.GetObjectHeight( "-1" )) == undefined
  43.     || !window.external.SetObjectSize || window.external.SetObjectSize( "-1", w, h ) == undefined
  44.     || !window.external.GetObjectHTML || (h = window.external.GetObjectHTML( "-1" )) == undefined
  45.     || !window.external.SetObjectHTML || window.external.SetObjectHTML( "-1", (h == defined ? "" : h) ) == undefined
  46.     || !window.external.GetObjectFiles || window.external.GetObjectFiles( "-1", ";" ) == undefined
  47.     || !window.external.SetObjectFiles // unrealistic to check all argument variants here just assume they are supported || window.external.SetObjectFiles( "-1", file0, file1, ... fileN ) == undefined
  48.       || !window.external.CopyFile || window.external.CopyFile("","") == undefined
  49. )
  50. {
  51.     AlertClose( requires_cp_update );
  52. }
  53. function AlertClose(msg)
  54. {
  55.     alert(msg);
  56.     document.write("<HEAD><BODY></BODY></HEAD></HTML>");
  57.     document.close();
  58. }
  59. function ChkErr( return_value )
  60. {
  61.     if( return_value == "" || return_value == undefined )
  62.     {
  63.         AlertClose( unexpected_error );
  64.         return undefined;
  65.     }
  66.     return return_value;
  67. }
  68.  
  69. var prefix = "file:///";
  70. var url = window.location.href;
  71. if(url.indexOf(prefix) != 0)
  72. {
  73.     alert(unexpected_error);
  74. }
  75. var temp_folder=url.substring(prefix.length, url.lastIndexOf("/")).replace( /%20/g, " ").replace( /\//g, "\\");
  76.  
  77. // Return current values of HTML object
  78. function ParseHTML()
  79. {
  80.       var current = new Array("swfwidth","swfheight","swfbgcolor","swfurl","swftype","swftarget","swfsize",
  81.                         "swftext");
  82.       current["swfwidth"] = 468;
  83.       current["swfheight"] = 60;
  84.       current["swfbgcolor"] = "1";
  85.       current["swfurl"] = "http://www.flareworks.com";
  86.       current["swftype"] = "0";
  87.       current["swftarget"] = "_blank";
  88.       current["swfsize"] = "0";
  89.       current["swftext"] = "Flying Message";
  90.  
  91.     var html = ChkErr(window.external.GetObjectHTML("-1"));
  92.       if(html==defined)
  93.         return current;
  94.  
  95.       current["swfwidth"] = ChkErr(window.external.GetObjectWidth("-1"));
  96.       current["swfheight"] = ChkErr(window.external.GetObjectHeight("-1"));
  97.       var s = 'current["swftext"] = ';
  98.       var i = html.indexOf(s);
  99.       if(i<0) alert(unexpected_error);
  100.       else
  101.       {
  102.         s = html.substring(i+s.length);
  103.         i = s.indexOf(';');
  104.         if(i<0)alert(unexpected_error);
  105.         else current["swftext"] = s.substring(1,i-1);
  106.       }
  107.       s = 'current["swfbgcolor"] = ';
  108.       i = html.indexOf(s);
  109.       if(i<0) alert(unexpected_error);
  110.       else
  111.       {
  112.         s = html.substring(i+s.length);
  113.         i = s.indexOf(';');
  114.         if(i<0)alert(unexpected_error);
  115.         else current["swfbgcolor"] = s.substring(1,i-1);
  116.       }
  117.       s = 'current["swftype"] = ';
  118.       i = html.indexOf(s);
  119.       if(i<0) alert(unexpected_error);
  120.       else
  121.       {
  122.         s = html.substring(i+s.length);
  123.         i = s.indexOf(';');
  124.         if(i<0)alert(unexpected_error);
  125.         else current["swftype"] = s.substring(1,i-1);
  126.       }
  127.       s = 'current["swftarget"] = ';
  128.       i = html.indexOf(s);
  129.       if(i<0) alert(unexpected_error);
  130.       else
  131.       {
  132.         s = html.substring(i+s.length);
  133.         i = s.indexOf(';');
  134.         if(i<0)alert(unexpected_error);
  135.         else current["swftarget"] = s.substring(1,i-1);
  136.       }
  137.       s = 'current["swfsize"] = ';
  138.       i = html.indexOf(s);
  139.       if(i<0) alert(unexpected_error);
  140.       else
  141.       {
  142.         s = html.substring(i+s.length);
  143.         i = s.indexOf(';');
  144.         if(i<0)alert(unexpected_error);
  145.         else current["swfsize"] = s.substring(1,i-1);
  146.       }
  147.       s = 'current["swfurl"] = ';
  148.       i = html.indexOf(s);
  149.       if(i<0)alert(unexpected_error);
  150.       else
  151.       {
  152.         s = html.substring(i+s.length);
  153.         i = s.indexOf(';');
  154.         if(i<0)alert(unexpected_error);
  155.         else current["swfurl"] = s.substring(1,i-1);
  156.       }
  157.  
  158.       return current;
  159. }
  160.  
  161. // Assign current values to GUI form
  162. function ReadSelectedObject( form )
  163. {
  164.      var current = ParseHTML();
  165.  
  166.     form.width.value=current["swfwidth"];
  167.     form.height.value=current["swfheight"];
  168.     form.text.value=current["swftext"];
  169.     form.target.value=current["swftarget"];
  170.     form.url.value=current["swfurl"];
  171.     form.size.selectedIndex=current["swfsize"];
  172.     form.type.selectedIndex=current["swftype"];
  173.     if(current["swfbgcolor"]==1)
  174.         form.bgcolor[0].checked = true;
  175.     if(current["swfbgcolor"]==2)
  176.         form.bgcolor[1].checked = true;
  177.     if(current["swfbgcolor"]==3)
  178.         form.bgcolor[2].checked = true;
  179.  
  180.       // Copy files to TEMP folder
  181.     ChkErr( window.external.CopyFile( objects_folder + "Flash\\Flare\\" + swf_file1,temp_folder ) );
  182.     ChkErr( window.external.CopyFile( objects_folder + "Flash\\Flare\\" + swf_file2,temp_folder ) );
  183.     ChkErr( window.external.CopyFile( objects_folder + "Flash\\Flare\\" + swf_file3,temp_folder ) );
  184.   
  185.       return current;
  186. }
  187.  
  188. // The HTML written to file
  189. function SWF_HTML( which )
  190. {
  191. var w;
  192. var h;
  193. var number;
  194. number=Math.round(100000*Math.random());
  195. if (which==0)
  196. {
  197.    w=420;
  198.    h=54;
  199.    num="";
  200. }
  201. else
  202. {
  203.    w=ChkErr(window.external.GetObjectWidth("-1"));
  204.    h=ChkErr(window.external.GetObjectHeight("-1"));
  205.    num=number;
  206. }
  207. var t="<OBJECT classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"\r\n";
  208. t+=" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,0,0\"\r\n";
  209. t+=" id=swfmovie"+num+" width="+w+" height="+h+">\r\n";
  210. t+="<PARAM NAME=movie VALUE=\"" + swf_file + "\" ><PARAM NAME=quality VALUE=high><PARAM NAME=scale VALUE=exactfit>\r\n";
  211. t+="<EMBED src=\"" + swf_file + "\" name=swfmovie"+num;
  212. t+=" pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\"\r\n";
  213. t+=" type=\"application/x-shockwave-flash\"";
  214. t+=" swLiveConnect=true scale=exactfit width="+w+" height="+h+" quality=high></EMBED>\r\n";
  215. t+="</OBJECT>\r\n";
  216. t+="\r\n<SCRIPT LANGUAGE=\"JavaScript\">\r\n";
  217. t+="<!";
  218. t+="-";
  219. t+="-";
  220. t+="\r\nfunction setparam"+num+"()\r\n{\r\n";
  221. t+="var current = new Array(\"swfbgcolor\",\"swfurl\",\"swftype\",\"swftarget\",\"swfsize\",\"swftext\",\"swffile\");";
  222. t+="\r\ncurrent[\"swfbgcolor\"] = \"" + swfcolor + "\";";
  223. t+="\r\ncurrent[\"swfurl\"] = \"" + window.document.editor.url.value + "\";";
  224. t+="\r\ncurrent[\"swftype\"] = \"" + window.document.editor.type.selectedIndex + "\";";
  225. t+="\r\ncurrent[\"swftarget\"] = \"" + window.document.editor.target.value + "\";";
  226. t+="\r\ncurrent[\"swfsize\"] = \"" + window.document.editor.size.selectedIndex + "\";";
  227. t+="\r\ncurrent[\"swftext\"] = \"" + window.document.editor.text.value + "\";";
  228. t+="\r\ncurrent[\"swffile\"] = \"" + logo_file + "\";";
  229. t+="\r\nwindow.document.swfmovie"+num+".SetVariable(\"textfx\",current[\"swftext\"]);\r\n";
  230. t+="window.document.swfmovie"+num+".SetVariable(\"mywebsite\",current[\"swfurl\"]);\r\n";
  231. t+="window.document.swfmovie"+num+".SetVariable(\"tarvar\",current[\"swftarget\"]);\r\n}\r\n";
  232. t+="/";
  233. t+="/";
  234. t+="-";
  235. t+="-";
  236. t+=">";
  237. t+="\r\n</SCRIPT>";
  238. t+="\r\n<IMG SRC=\"t.gif\" ALT=\"\" WIDTH=1 HEIGHT=1 BORDER=0 VSPACE=0 HSPACE=0 onLoad=\"javascript:setparam"+num+"()\">";
  239.  
  240. return t;
  241. }
  242.  
  243. function WriteSelectedObject( form )
  244. {
  245.     // Unable to resize object in Cool Page (and Cool Page already displayed error to user)?
  246.     if( !window.external.SetObjectSize( "-1", form.width.value, form.height.value) )
  247.         return;
  248.  
  249.     var html=SWF_HTML(1);
  250.      var current = ParseHTML();
  251.  
  252.      ChkErr(window.external.SetObjectFiles("-1")); 
  253.      ChkErr(window.external.SetObjectHTML("-1",html));
  254.         ChkErr(window.external.SetObjectFiles("-1",logo_file,swf_file));
  255. }
  256.  
  257. function passText(str) 
  258. {
  259.     if(str == "size")
  260.     {
  261.         window.document.editor.width.value=swfwidth;
  262.         window.document.editor.height.value=swfheight;
  263.         alert('Width and Height are fixed to the original SWF movie size.');
  264.     }
  265.  
  266.     if(str == "aspect")
  267.         alert('If Width or Height are changed the other dimension will be changed to match the orginal SWF movie aspect ratio.');
  268.  
  269.     if(str == "any")
  270.         alert('Any size Width or Height can be entered.')
  271.  
  272.     WriteSelectedObject( window.document.editor );
  273. }
  274.  
  275. function SWFpass(vars, val)
  276. {
  277.     window.document.swfmovie.SetVariable(vars,val);
  278.     WriteSelectedObject( window.document.editor );
  279. }
  280.  
  281. function PassUrl(url, target)
  282. {
  283.     window.document.swfmovie.SetVariable('tarvar',target);
  284.     window.document.swfmovie.SetVariable('mywebsite',url); 
  285.     WriteSelectedObject( window.document.editor );
  286. }
  287.  
  288. function PassType(form, val)
  289. {
  290.       form.target.value = val;
  291.     WriteSelectedObject( window.document.editor );
  292. }
  293.  
  294. function SWFmovie(swfmov, val)
  295. {
  296.     window.document.swfmovie.LoadMovie(0,swfmov);
  297.     SWFpass('textfx',window.document.editor.text.value);
  298.     PassUrl(window.document.editor.url.value,window.document.editor.target.value);
  299.     swfcolor = val;
  300.     swf_file = swfmov;
  301.     WriteSelectedObject( window.document.editor );
  302. }
  303.  
  304. function widthchg(str)
  305. {
  306.     if(str == "size")
  307.     {
  308.         window.document.editor.width.value=swfwidth;
  309.         window.document.editor.height.value=swfheight;
  310.     }
  311.  
  312.     if(str == "aspect")
  313.         window.document.editor.height.value=Math.round((window.document.editor.width.value)*(swfheight/swfwidth));
  314.  
  315.     WriteSelectedObject( window.document.editor );
  316. }
  317.  
  318.  
  319.  
  320. function heightchg(str)
  321. {
  322.     if(str == "size")
  323.     {
  324.         window.document.editor.width.value=swfwidth;
  325.         window.document.editor.height.value=swfheight;
  326.     }
  327.  
  328.     if(str == "aspect")
  329.             window.document.editor.width.value=Math.round((window.document.editor.height.value)*(swfwidth/swfheight));
  330.  
  331.     WriteSelectedObject( window.document.editor );
  332. }
  333. // End -->
  334. </SCRIPT>
  335. </HEAD>
  336.  
  337. <STYLE TYPE="text/css">TD {font:normal 10pt Arial, sans-serif; color:#ffff00}</STYLE>
  338.  
  339. <BODY SCROLL="auto"  bgcolor="666699" text="000000" VLINK="#f0f0f0" ALINK="#ffcc00" LINK="#f0f0f0">
  340. <center>
  341. <SCRIPT LANGUAGE="JavaScript">
  342. <!-- Begin
  343. ChkErr( window.external.CopyFile( objects_folder + "Clip Art\\" + logo_file, temp_folder ) );
  344. // End -->
  345. </SCRIPT>
  346. <center>
  347. <IMG SRC="Flare SWFlet Logo.gif" WIDTH=230 HEIGHT=43><br>
  348. <font face="arial, helvetica" size=2 color="D9D9D9">
  349. <b>Visit <a href="http://www.imediabuilders.com" target="imediawin">iMEDIA Builders</a> 
  350. for help with this and other SWFlets.</b></font><br><br>
  351. <FORM NAME="editor" ACTION="">
  352. <table border=1 bgcolor="ddddd0">
  353.    <tr>
  354.       <td>
  355.     <table width=420 border=0 cellspacing=0 cellpadding=4>
  356.         <TR>
  357.            <TD><font color="000000"><b>Enter Text:</b></font></TD>
  358.            <td><input type=text name="text" size=24 maxlength=17 onBlur="javascript:SWFpass('textfx',text.value)"></td>
  359.          </tr>
  360.        <tr>
  361.        <td><font color="000000"><b>Background Color:</b></font></td><td><TABLE BORDER=0 bgcolor="FFFFFF"><TR>
  362.          <TD BGCOLOR="#000000"><input CHECKED type="radio" name="bgcolor" onClick="SWFmovie(swf_file1,'1')" value="1">                 </A></TD>
  363.          <TD BGCOLOR="#FFFFFF"><input type="radio" name="bgcolor" onClick="SWFmovie(swf_file2,'2')" value="2">                 </A></TD>
  364.          <TD BGCOLOR="#FFFF00"><input type="radio" name="bgcolor" onClick="SWFmovie(swf_file3,'3')"  value="3">                 </A></TD>
  365.          </TR>
  366.       </table>
  367.       </td>
  368.    </tr>
  369.    <TR>
  370.    <TD><font color="000000"><b>URL Link:</b></font></TD>
  371.    <TD><input type="text" size="39" name="url" value="http://" onBlur="javascript:PassUrl(url.value,target.value)"></td>
  372.    </TR>
  373.    <TR>
  374.    <TD><font color="000000"><b>Target Type:</b></font></TD>
  375.    <TD><SELECT name="type" onChange="javascript:PassType(this.form,this.value)">
  376.       <OPTION SELECTED VALUE="_blank"> New Window</OPTION>
  377.       <OPTION VALUE="_self">Current Frame of Window</OPTION>
  378.       <OPTION VALUE="_top"> Entire Frame of the Current Window</OPTION>
  379.       <OPTION VALUE=""> User Defined </OPTION></SELECT></td>
  380.    </TR>
  381.    <TR>
  382.    <TD><font color="000000"><b>Target Value:</b></font></TD>
  383.    <TD><input type="text" size="39" name="target" value="_blank" onChange="javascript:WriteSelectedObject(this.form);"></TD>
  384.    </TR>
  385.    <tr>
  386.    <td><font color="000000"><b>Dimensions:</b></font></td>
  387.    <td><select name="size" onchange="javascript:passText(this.options[this.selectedIndex].value)">
  388.       <option value="size" selected>Original Size
  389.       <option value="aspect">Original Aspect
  390.       <option value="any">Any Size</select>
  391.      <font color="000000"><b>W</b></font> <input type="text" size=4 maxlength=4 name=width value=" " onChange="javascript:widthchg(this.form.size.value);">
  392.        <font color="000000"><b>H</b></font> 
  393.    <input type="text" size=4 maxlength=4 name=height value=" " onChange="javascript:heightchg(this.form.size.value);">
  394.    </td>
  395.    </tr>
  396.     <tr>
  397.     <td colspan=2 align=center>
  398.    <font size=1 face="arial" color="000000"><b>Preview below does not match edited dimensions</b></font>
  399.     </td>
  400.     </tr>
  401. </table>
  402. </FORM>
  403.  
  404. <SCRIPT LANGUAGE="JavaScript">
  405. <!-- Begin
  406.  
  407. current = ReadSelectedObject( document.editor );
  408. document.write( SWF_HTML( 0 ) );
  409. if(window.external.GetObjectHTML("-1")==defined)
  410.       WriteSelectedObject( document.editor );
  411. if(window.document.editor.bgcolor[0].checked == true)
  412.       SWFmovie(swf_file1,'1');
  413. if(window.document.editor.bgcolor[1].checked == true)
  414.       SWFmovie(swf_file2,'2');
  415. if(window.document.editor.bgcolor[2].checked == true)
  416.       SWFmovie(swf_file3,'3');
  417.  
  418. // End -->
  419. </SCRIPT>
  420.  
  421. </table>
  422. </center>
  423.  
  424. <!--Start Promotional Stuff -->
  425. <br><table width=420 cellspadding=0 cellspacing=0 >
  426. <tr><td><font face="arial, helvetica" size=2 color="D9D9D9"><b>
  427. These SWFlets were created by iMEDIA Builders and are provided as free plugins
  428. for Cool Page by iMEDIA Builders. iMEDIA Builders.com and CoolPage.com are
  429. owned by separate companies.
  430. <p>The above SWFlet (pronounced "swif-let") is offered free for unlimited use.  
  431. Just remember to visit <a href="http://www.imediabuilders.com" target="imediawin"> iMEDIA Builders</a> 
  432. to view and download more Flare SWFlets and Flash animation products. All Flash (SWF) movies published 
  433. with a FlareSWFlet, FlareExpress, or FlareWorks are compatible with CoolPage's drag-n-drop, resizing, 
  434. positioning, publishing, and unlimited undo features.
  435. <p>
  436. iMEDIA Builders has <a href="http://www.swflets.com" target="imediawin">Flare SWFlets</a> to easily create Text Effects, 
  437. Ad Banners, and Animation Clips including the ability to customize scale, opacity, rotate, motion paths, 
  438. and other effects.  You can pick the font type, size, color, load any GIF or JPG image and set the URL link.</font>
  439. </td></tr></table></center>
  440. <!--End Promotional Stuff -->
  441.  
  442. </BODY>
  443. </HTML>